//258.各位相加
//https://leetcode.cn/problems/add-digits/
class Solution {
public:
    int addDigits(int num) {
        int n = num;
        while(n>=10)
        {
            int tmp = 0;
            while(n)
            {
                tmp += n%10;
                n /= 10;
            }
            n = tmp;
        }
        return n;
    }
};
